{% load humanize %}

<div class="col-12 table-responsive">
    {# 계약자 리스트 #}
    <div class="row">
        <div class="col-sm"><h5><i class="dripicons-view-apps text-primary"></i> 계약해지 현황
        </h5></div>
        <div class="col-sm text-right mr-2">
            <span class="text-black-50">총 계약해지 건수 : {{ total_release }} 건</span>
            <a href="{% url 'excel:releases' %}?project={{ this_project.id }}" class="ml-3">
                <i class="mdi mdi-file-excel-box"></i> Excel Export
                <i class="mdi mdi-download ml-1"></i>
            </a>
        </div>
    </div>
    <table id="scroll-horizontal-datatable"
           class="table table-hover table-centered table-condensed table-sm w-100 m-0 nowrap"
           style="word-break: keep-all;">
        <thead>
        <tr class="bg-nav-pills">
            <th scope="col" rowspan="2"><input type="checkbox" disabled></th>
            <th class="text-center" rowspan="2" scope="col">계약 해지자</th>
            <th class="text-center" rowspan="2" scope="col">현재상태</th>
            <th class="text-center" rowspan="2" scope="col">환불(예정)금액</th>
            <th class="text-center" colspan="3" scope="col">환불계좌</th>
            <th class="text-center" rowspan="2" scope="col">해지신청일</th>
            <th class="text-center" rowspan="2" scope="col">환불처리일</th>
        </tr>
        <tr class="bg-nav-pills">
            <th class="text-center">은행명</th>
            <th class="text-center">계좌번호</th>
            <th class="text-center">예금주</th>
        </tr>
        </thead>
        <tbody>
        {% for object in object_list %}
            <tr>
                <th scope="row"><input type="checkbox" disabled></th>
                <td class="text-center text-dark"
                    {% if object.note %}
                        data-toggle="tooltip"
                        data-placement="right" title=""
                        data-original-title="{{ object.note }}"
                    {% endif %}>
                    {% if object.status == '3' %}
                        <a href="{% url 'rebs:contract:release' %}?project={{ this_project.id }}&task={{ object.status }}&contractor={{ object.contractor.id }}&release_id={{ object.id }}">
                    {% endif %}
                        {{ object.contractor|truncatechars:"26" }}
                    {% if object.status == '3' %}</a>{% endif %}
                </td>
                <td class="text-center {% if object.status == '3' %}text-success{% else %}text-dark{% endif %}">{{ object.get_status_display }}</td>
                <td class="text-right">{{ object.refund_amount|default:"-"|intcomma }}</td>
                <td class="text-center">{{ object.refund_account_bank|default:"-" }}</td>
                <td class="text-center">{{ object.refund_account_number|default:"-" }}</td>
                <td class="text-center">{{ object.refund_account_depositor|default:"-" }}</td>
                <td class="text-center">{{ object.request_date|date:"Y-m-d" }}</td>
                <td class="text-center">{{ object.completion_date|date:"Y-m-d"|default:"-" }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
